1. Technical Field
The present invention relates generally to management of computer memory resources, and in particular, to allocation and replacement of virtual memory pages. More particularly, the present invention relates to a system and method for managing page replacement operations in virtual memory systems employing multiple page sizes.
2. Description of the Related Art
Virtual memory is a critical feature supported by most modern operating systems in conjunction with memory management hardware. Virtual memory essentially provides an alternate set of memory addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. When called by program threads, the virtual addresses are converted into physical or “real” memory addresses.
To facilitate copying virtual memory into real memory, almost all modern operating systems divide virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. When a page is needed, the operating system copies it from disk to main memory, translating its virtual address into a real address. Basic to implementing virtual memory is the concept of demand paging, meaning the system (usually the operating system), and not the programmer, controls the replacement of pages in and out of main memory as required by active processes. When a non-resident page is needed by a process, the operating system utilizes a specified replacement policy to decide which resident memory page is to be replaced by the requested page. Most convention replacement policies, such as least recently used (LRU), first in first out (FIFO), etc., generally share the objective of selecting for replacement, a page that will not be referenced for the longest time.
To improve system performance, many computer architectures and operating systems have begun adding support for multiple page sizes. For example, in a system using two page sizes of 4K bytes and 64K bytes, the relative allocation of the memory between the page sizes is set by reserving specified portions of memory for the respective page sizes. To improve system reliability and usability, an operating system would ideally determine how much of a system's memory to use for each page size autonomically and dynamically adjust these amounts based on a particular workload demand at any given point in time.
When all of the page frames for a requested page size have been allocated, the operating system must determine how to handle further requests for page frames of that page size. Operating systems have traditionally had two basic options. First, page replacements may be started for page frames of the requested page size. In the alternative, currently non-allocated, or “free” memory reserved for a non-requested size may be converted to blocks of the requested page size and used in satisfaction of the page frame allocation requests. Using these options, the operating system is able to select the page size shift option over the more costly page replacement option when free page frames are available.
However, when memory utilization is sufficiently high such there are insufficient free page frames from any page size to satisfy an allocation request, page replacement (sometimes referred to as page swapping) must be utilized to free up memory to copy in the requested pages. There exists a need in the art to determine whether the page replacement should be performed with respect to the requested page size or other page sizes in a manner that improves system efficiency and reliability. The present invention addresses this and other needs unresolved by the prior art.